<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>

		<script type="text/javascript">
function t7(){
  			  //form   =   window.document.forms[0];
              //var addr=form.country2.value;
             
 
	$.ajax( 
	{
	
		url : "testSelected.do",
		type : 'POST',
		//data : "userName="+addr,
		dataType : 'json',
		success : function(data) {
		
	var sid = document.getElementsByName("country2");
	  var op='';
      var val='';
    for(var i=0;i<data.length;i++){  
     var opt = document.createElement('option'); 
      op=data[i];
      val=i;
   	 opt.appendChild(document.createTextNode(op));  
		 opt.setAttribute("value",op); 
		 sid[0].appendChild(opt); 
   }  
			
			
			}
			
	});
			
			}
			
			function t8(){
				var sid1 = document.getElementsByName("country2");
				if(sid1[0].value==""){
					return;
				}
						
				
				var s =sid1[0].options[sid1[0].selectedIndex].text;
				//sid1[0].options.length=null;
				 
	$.ajax( 
	{
		url : "countrySelected.do",
		type : 'POST',
		data : "country="+s,
		dataType : 'json',
		success : function(data) {
	  var sidcity2 = document.getElementsByName("province2");
	  var s3 = document.getElementsByName("city2");
	  var s4 = document.getElementsByName("area2");
	  var s5 = document.getElementsByName("street2");
	    sidcity2[0].options.length=null;
	    s3[0].options.length=null;
	    s4[0].options.length=null;
	    s5[0].options.length=null;
	     var qingxuanzeoption = document.createElement('option'); 
             qingxuanzetext="请选择";
			 qingxuanzeoption.appendChild(document.createTextNode(qingxuanzetext));  
			 qingxuanzeoption.setAttribute("value",qingxuanzetext); 
		 	 sidcity2[0].appendChild(qingxuanzeoption); 
		 var qingxuanzeoption3 = document.createElement('option'); 
             qingxuanzetext3="请选择";
			 qingxuanzeoption3.appendChild(document.createTextNode(qingxuanzetext3));  
			 qingxuanzeoption3.setAttribute("value",qingxuanzetext3); 
		 	 s3[0].appendChild(qingxuanzeoption3); 
		 var qingxuanzeoption4 = document.createElement('option'); 
             qingxuanzetext4="请选择";
			 qingxuanzeoption4.appendChild(document.createTextNode(qingxuanzetext4));  
			 qingxuanzeoption4.setAttribute("value",qingxuanzetext4); 
		 	 s4[0].appendChild(qingxuanzeoption4); 
		var qingxuanzeoption5 = document.createElement('option'); 
             qingxuanzetext5="请选择";
			 qingxuanzeoption5.appendChild(document.createTextNode(qingxuanzetext5));  
			 qingxuanzeoption5.setAttribute("value",qingxuanzetext5); 
		 	 s5[0].appendChild(qingxuanzeoption5); 
		 	 
	
	  var city2op='';
      var city2val='';
      for(var j=0;j<data.length;j++){  
         var city2opt = document.createElement('option'); 
             city2op=data[j];
			 city2opt.appendChild(document.createTextNode(city2op));  
			 city2opt.setAttribute("value",city2op); 
		 	 sidcity2[0].appendChild(city2opt); 
   }  
			
			
			}
			
	});
							
							
			}



function t9(){

				var sid2 = document.getElementsByName("province2");
					
				var ss = sid2[0].options[sid2[0].selectedIndex].text;
				 
	$.ajax( 
	{
		url : "provinceSelected.do",
		type : 'POST',
		data : "city="+ss,
		dataType : 'json',
		success : function(data) {
	  var city2select = document.getElementsByName("city2");
	   var s4 = document.getElementsByName("area2");
	   var s5 = document.getElementsByName("street2");
	 	  city2select[0].options.length=null;
	 	    s4[0].options.length=null;
	    	s5[0].options.length=null;
	  	  	var qingxuanzeoption = document.createElement('option'); 
             qingxuanzetext="请选择";
			 qingxuanzeoption.appendChild(document.createTextNode(qingxuanzetext));  
			 qingxuanzeoption.setAttribute("value",qingxuanzetext); 
		 	 city2select[0].appendChild(qingxuanzeoption); 
		 	  var qingxuanzeoption4 = document.createElement('option'); 
             qingxuanzetext4="请选择";
			 qingxuanzeoption4.appendChild(document.createTextNode(qingxuanzetext4));  
			 qingxuanzeoption4.setAttribute("value",qingxuanzetext4); 
		 	 s4[0].appendChild(qingxuanzeoption4); 
		var qingxuanzeoption5 = document.createElement('option'); 
             qingxuanzetext5="请选择";
			 qingxuanzeoption5.appendChild(document.createTextNode(qingxuanzetext5));  
			 qingxuanzeoption5.setAttribute("value",qingxuanzetext5); 
		 	 s5[0].appendChild(qingxuanzeoption5); 
		 	 
	  var city2text='';
      var city2value='';
      for(var k=0;k<data.length;k++){  
         var city2option = document.createElement('option'); 
             city2text=data[k];
			 city2option.appendChild(document.createTextNode(city2text));  
			 city2option.setAttribute("value",city2text); 
		 	 city2select[0].appendChild(city2option); 
   }  
			
			
			}
			
	});
			}
			
			function ta(){
				var sid3 = document.getElementsByName("city2");
					
				var sss = sid3[0].options[sid3[0].selectedIndex].text;
				 
	$.ajax( 
	{
		url : "areaSelected.do",
		type : 'POST',
		data : "area="+sss,
		dataType : 'json',
		success : function(data) {
	  var area2select = document.getElementsByName("area2");
	  var s5 = document.getElementsByName("street2");
	  	area2select[0].options.length=null;
	  	s5[0].options.length=null;
	  	var qingxuanzeoption = document.createElement('option'); 
             qingxuanzetext="请选择";
			 qingxuanzeoption.appendChild(document.createTextNode(qingxuanzetext));  
			 qingxuanzeoption.setAttribute("value",qingxuanzetext); 
		 	 area2select[0].appendChild(qingxuanzeoption); 
	  	var qingxuanzeoption5 = document.createElement('option'); 
             qingxuanzetext5="请选择";
			 qingxuanzeoption5.appendChild(document.createTextNode(qingxuanzetext5));  
			 qingxuanzeoption5.setAttribute("value",qingxuanzetext5); 
		 	 s5[0].appendChild(qingxuanzeoption5); 
		 	 
	  	
	  var area2text='';
      var area2value='';
      for(var l=0;l<data.length;l++){  
         var area2option = document.createElement('option'); 
             area2text=data[l];
			 area2option.appendChild(document.createTextNode(area2text));  
			 area2option.setAttribute("value",area2text); 
		 	 area2select[0].appendChild(area2option); 
   }  
			
			
			}
			
	});
			}
			
					function tb(){
				var sid3 = document.getElementsByName("area2");
					
				var sss = sid3[0].options[sid3[0].selectedIndex].text;
				 
	$.ajax( 
	{
		url : "streetSelected.do",
		type : 'POST',
		data : "street="+sss,
		dataType : 'json',
		success : function(data) {
	  var street2select = document.getElementsByName("street2");
	  	street2select[0].options.length=null;
	  	
	  	var qingxuanzeoption = document.createElement('option'); 
             qingxuanzetext="请选择";
			 qingxuanzeoption.appendChild(document.createTextNode(qingxuanzetext));  
			 qingxuanzeoption.setAttribute("value",qingxuanzetext); 
		 	 street2select[0].appendChild(qingxuanzeoption); 
	  	
	  var street2text='';
      var street2value='';
      for(var l=0;l<data.length;l++){  
         var street2option = document.createElement('option'); 
             street2text=data[l];
			 street2option.appendChild(document.createTextNode(street2text));  
			 street2option.setAttribute("value",street2text); 
		 	 street2select[0].appendChild(street2option); 
   }  
			
			
			}
			
	});
			}
			
		</script>

			country2 : <html:select property="country2" onchange="t8()">
				<html:option value="">请选择</html:option>
			</html:select>
			<html:errors property="country2" />
			
			province2 : <html:select property="province2" onchange="t9()">
				<html:option value="">请选择</html:option>
			</html:select>
			<html:errors property="province2" />		
			
			city2 : <html:select property="city2" onchange="ta()">
				<html:option value="">请选择</html:option>
			</html:select>
			<html:errors property="city2" />	
			
			
			area2/port : <html:select property="area2" onchange="tb()">
				<html:option value="">请选择</html:option>
			</html:select>
			<html:errors property="area2" />
			<br />
			
			street2/portnum : <html:select property="street2">
				<html:option value="">请选择</html:option>
			</html:select>
			<html:errors property="street2" />
			
			
			detail: <html:text property="startAddress6" value="address level6"  size="45"/>
		


